﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lxzhu.OpenGL;
using Tutorials;
namespace Tutorials.PrimitivePolygon
{
    class Program:GlutEngine
    {
        static void Main(string[] args)
        {
            Program rt = new Program();
            rt.Run();
        }
        private byte[] mHalfTone = new byte[] {
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
                0xAA,0xAA,0xAA,0xAA,0x55,0x55,0x55,0x55,
            };
        public override void OnDisplay()
        {
            
            Gl.glClear(BufferBit.GL_COLOR_BUFFER_BIT);
            Gl.glColor(1, 1, 1);
            Gl.glRect(-0.75, -0.5, -0.25, 0.5);
            Gl.glEnable(Capability.GL_POLYGON_STIPPLE);
            Gl.glPolygonStipple(mHalfTone);
            Gl.glRect(0.25, -0.5, 0.75, 0.5);
            Gl.glDisable(Capability.GL_POLYGON_STIPPLE);
            Gl.glFlush();

        }
    }
}
